
<?php
header('charset=utf-8');
$postid=($_POST["id"]);
$mysqli = new mysqli("127.0.0.1", "root", "20155222", "lzj");

/* check connection */
if ($mysqli->connect_errno) {
    printf("Connect failed: %s\n", $mysqli->connect_error);
    exit();
}
$sql="select * from posts where postid = $postid ;";

if ($result = $mysqli->query($sql)) {
	for($i=0;$i<$result->num_rows;$i++){	
		$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
		current($row);
		next($row);
		$htmlstr="<div style='width:100%;'>
				<div style='font-size: 25px;width:20%; float:left'>".next($row)."</div>
				<div style='font-size: 25px;margin-left:20%;border-left-width:2px ;border-left-style:solid; border-left-color:gray; padding-left:10px' id='title'>title:".next($row)." <br><br> </div>
				<div id='content' style='font-size: 20px;margin-left:20%;border-left-width:2px ;border-left-style:solid; border-left-color:gray; padding-left:10px' id='title'>".next($row)."</div>
			  </div>
			<hr>
			  ";
	}

	$result->close();
}
$sql="select * from replys where postid = $postid ;";
if ($result = $mysqli->query($sql)) {
	for($i=0;$i<$result->num_rows;$i++){	
		$row = mysqli_fetch_array($result, MYSQLI_ASSOC);
		current($row);
		next($row);
		$htmlstr.="<br><br><div style='width:100%;'>
				<div style='font-size: 25px;width:20%; float:left'>".next($row)."</div>
				<div id='content' style='font-size: 20px;margin-left:20%;border-left-width:2px ;border-left-style:solid; border-left-color:gray; padding-left:10px' id='title'>".next($row)."</div>
			  </div>
			<hr>
			  ";
	}

	$result->close();
}
$mysqli->close();

echo $htmlstr;
?>

